package com.jy.modules.cims.component.common.service;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.jy.modules.cims.data.common.dao.TCMmCooperorgDealReleDao;
import com.jy.modules.cims.data.common.dto.TCMmCooperorgDealReleDTO;
import com.jy.platform.core.common.BaseDTO;


/**
 * @classname: TCMmCooperorgDealReleService
 * @description: 定义  T_C_MM_COOPERORG_DEAL_RELE 实现类
 * @author:  dell
 */
@Service("com.jy.modules.platform.tcmmcooperorgdealrele.service.TCMmCooperorgDealReleService")
public class TCMmCooperorgDealReleService implements Serializable {

    private static final long serialVersionUID = 1L;
    
	@Autowired
	private TCMmCooperorgDealReleDao dao;

	/**
     * @author dell
     * @description: 分页查询 T_C_MM_COOPERORG_DEAL_RELE列表
     * @date 2015-08-31 09:33:27
     * @param searchParams 条件
     * @return
     * @throws
     */ 
	public List<TCMmCooperorgDealReleDTO> searchTCMmCooperorgDealReleByPaging(Map<String,Object> searchParams) throws Exception {
		List<TCMmCooperorgDealReleDTO> dataList =  dao.searchTCMmCooperorgDealReleByPaging(searchParams);
		return dataList;
	}
	/**
     * @author dell
     * @description: 按条件查询T_C_MM_COOPERORG_DEAL_RELE列表
     * @date 2015-08-31 09:33:27
     * @param searchParams 条件
     * @return
     * @throws
     */
	public List<TCMmCooperorgDealReleDTO> searchTCMmCooperorgDealRele(Map<String,Object> searchParams) throws Exception {
	    List<TCMmCooperorgDealReleDTO> dataList = dao.searchTCMmCooperorgDealRele(searchParams);
        return dataList;
    }
	/**
     * @author dell
     * @description: 查询T_C_MM_COOPERORG_DEAL_RELE对象
     * @date 2015-08-31 09:33:27
     * @param id
     * @return
     * @throws
     */ 
	public TCMmCooperorgDealReleDTO queryTCMmCooperorgDealReleByPrimaryKey(String id) throws Exception {
		
		TCMmCooperorgDealReleDTO dto = dao.findTCMmCooperorgDealReleByPrimaryKey(id);
		
		if(dto == null) dto = new TCMmCooperorgDealReleDTO();
		
		return dto;
		
	}

	/**
     * @title: insertTCMmCooperorgDealRele
     * @author dell
     * @description: 新增 T_C_MM_COOPERORG_DEAL_RELE对象
     * @date 2015-08-31 09:33:27
     * @param dto
     * @return
     * @throws
     */
	@SuppressWarnings("all")
	public Long insertTCMmCooperorgDealRele(TCMmCooperorgDealReleDTO dto) throws Exception {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", dto);
		
		int count = dao.insertTCMmCooperorgDealRele(paramMap);
		
		TCMmCooperorgDealReleDTO resultDto = (TCMmCooperorgDealReleDTO) paramMap.get("dto");
		Long keyId = resultDto.getId();
		return keyId;
	}
	/**
     * @title: updateTCMmCooperorgDealRele
     * @author dell
     * @description: 修改 T_C_MM_COOPERORG_DEAL_RELE对象
     * @date 2015-08-31 09:33:27
     * @param paramMap
     * @return
     * @throws
     */
	public void updateTCMmCooperorgDealRele(TCMmCooperorgDealReleDTO dto) throws Exception {
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", dto);
		
		dao.updateTCMmCooperorgDealRele(paramMap);
	}
	/**
     * @title: deleteTCMmCooperorgDealReleByPrimaryKey
     * @author dell
     * @description: 删除 T_C_MM_COOPERORG_DEAL_RELE,按主键
     * @date 2015-08-31 09:33:27
     * @param paramMap
     * @throws
     */ 
	public void deleteTCMmCooperorgDealReleByPrimaryKey(BaseDTO baseDto,String ids) throws Exception {
		if(StringUtils.isEmpty(ids)) throw new Exception("删除失败！传入的参数主键为null");
		
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", baseDto);
		paramMap.put("ids", ids);
		dao.deleteTCMmCooperorgDealReleByPrimaryKey(paramMap);
	}

	/**
     * @title: deleteTCMmCooperorgDealReleByID
     * @author dell
     * @description: 删除 T_C_MM_COOPERORG_DEAL_RELE,按主键
     * @date 2015-08-31 09:33:27
     * @param paramMap
     * @throws
     */ 
	public void deleteTCMmCooperorgDealReleByID(BaseDTO baseDto,String ids) throws Exception {
		if(StringUtils.isEmpty(ids)) throw new Exception("删除失败！传入的参数主键为null");
		
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("dto", baseDto);
		paramMap.put("ids", ids);
		dao.deleteTCMmCooperorgDealReleByID(paramMap);
	}
}

